package com.wn.icloud.provider.uac.controller;

import com.wn.icloud.common.msg.ObjectRestResponse;
import com.wn.icloud.common.msg.TableResultResponse;
import com.wn.icloud.common.util.Query;
import com.wn.icloud.provider.uac.entity.EnterpriseHeadlines;
import com.wn.icloud.provider.uac.service.EnterpriseHeadlinesBiz;
import com.wn.icloud.rest.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@RequestMapping("/content/headlines")
public class EnterpriseHeadlinesController extends BaseController<EnterpriseHeadlinesBiz, EnterpriseHeadlines> {

    @RequestMapping(value = "/page", method = RequestMethod.GET)
    @ResponseBody
    @Override
    public TableResultResponse<EnterpriseHeadlines> list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);
        return baseBiz.findByPage(query);
    }

    @DeleteMapping(value = "/deleteByIds")
    @ResponseBody
    public void deleteByIds(String ids) {
        baseBiz.deleteByIds(ids);
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public ObjectRestResponse<EnterpriseHeadlines> addEnterpriseHeadlines(@RequestBody EnterpriseHeadlines enterpriseHeadlines) {
        return baseBiz.addEnterpriseHeadlines(enterpriseHeadlines);
    }

    @RequestMapping(value = "/update", method = RequestMethod.PUT)
    @ResponseBody
    public ObjectRestResponse<EnterpriseHeadlines> updateEnterpriseHeadlines(@RequestBody EnterpriseHeadlines enterpriseHeadlines) {
        return baseBiz.updateEnterpriseHeadlines(enterpriseHeadlines);
    }
}
